import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)
const routes = [
  // 如果路径是/那么就重定向到login路径
  {
    path: '/',
    redirect: '/home',
    meta: { title: '积分商城管理端' }, 
  },
  {
    path: '/home',
    name: 'home',
    component: () => import('@/components/Home.vue'),
    // 如果路由地址是/home就重定向到/welcome
    redirect: '/welcome',
    meta: { title: '积分商城管理端' },
    children: [
      {
        path: '/welcome',
        name: 'welcome',
        label: '首页',
        component: () => import('@/components/Welcome.vue'),
        meta: { title: '积分商城管理端-首页' }
      },

      {
        path: '/drawrecord/sendOut',
        name: 'sendOut',
        label: '发货',
        component: () => import('@/components/drawrecord/sendOut.vue'),
        meta: { title: '发货' }
      },
      //商品详情
      {
        // path: '/api/products/details',
        path: '/productsDetail',
        name: 'productsDetail',
        label: '积分商品',
        component: () => import('@/components/drawrecord/productsDetail.vue'),
        meta: { title: '积分商品' }
      },

    ]
  }
]

const router = new VueRouter({
  mode: 'history',
  routes
})
export default router
